package com.masterclient.app.modules.firstpager.fragments.adapters;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.masterclient.app.R;
import com.eoner.baselibrary.bean.firstpager.BrandListBean;

import java.util.List;

/**
 * 作者：sean
 * 创建时间：2017/7/10 11:06
 * 功能说明：
 */

public class VideoSelectAdapter extends BaseAdapter{

    public void setList(List<BrandListBean.DataBean> list) {
        this.list = list;
        notifyDataSetChanged();
    }

    private List<BrandListBean.DataBean> list;
    private Context context;
    public VideoSelectAdapter(Context context) {
        this.context = context;
    }

    @Override
    public int getCount() {
        return list == null?0:list.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        BrandListBean.DataBean videoBean = list.get(position);
        TextView tv = (TextView) View.inflate(context, R.layout.text_condition,null);
        tv.setText(videoBean.getSh_name());
        if(videoBean.isCheck()){
            tv.setBackgroundResource(R.drawable.bg_tag_red);
            tv.setTextColor(0xffcc363c);
        }else {
            tv.setBackgroundResource(R.drawable.bg_search_et);
            tv.setTextColor(0xff444444);
        }
        return tv;
    }
}
